<div id="opportunitiesPage">
    <div class="post">
        <h2 class="title">Business opportunities</h2>
        <div class="entry">
            <script>
                $(function() {
                    $( "#lett_datepicker" ).datepicker({ dateFormat: 'yy-mm-dd' });
                });
                $(function() {
                    $( "#lett_datepicker2" ).datepicker({ dateFormat: 'yy-mm-dd' });
                });

            </script>

            <input type="button" value="Add new" onclick="show('#new_opportunities')"/>
            <?php
            //if ($this->session->userdata("admin")) {
            ?>
                <input type="button" value="Search" onclick="show('#searchOpportunities')"/>
                <input type="button" value="Clear Search" onclick="clearSearch()"/>
            <?php
            //}
            ?>
            <div id="opportunities_result" class="info">
                <?= $message ?>
            </div>
            <script type="text/javascript">
                function searchOpportunities(){
                    field=document.getElementById("searchOpportunitiesForm").field.value;
                    search=document.getElementById("searchOpportunitiesForm").search.value;
                    $("#opportunitiesPage").load("<?= base_url(); ?>index.php?/admin_mis/opportunities/"+field+"/"+search);
                }
                function clearSearch(){
                    $("#opportunitiesPage").load("<?= base_url(); ?>index.php?/admin_mis/opportunities/");
                }
            </script>




            <div id="opportunities_result" style="display: none">
            </div>
            <!--a href="" id="hide3" >Hide</a> <a href="" id="show3" >Show</a-->
            <div id="new_opportunities" style="display: none;margin-bottom: 10px;">
                <?php $data['id'] = "doc_form" ?>
                <?= form_open_multipart('mis/saveOpportunities', $data); ?>
                <table>
                    <tr class="darker"><td class="half">Opportunity</td><td><input type="text" class="wide" name="opportunity" value="<?php echo set_value('opportunity'); ?>" /></td> </tr>
                    <tr class="lighter"><td class="half">Source</td><td><input type="text" class="wide" name="source" value="<?php echo set_value('source'); ?>" /></td> </tr>
                    <tr class="darker"><td class="half">Beneficiary</td><td><input type="text" class="wide" name="beneficiary" value="<?php echo set_value('beneficiary'); ?>" /></td> </tr>
                    <tr class="lighter"><td class="half">Approach (EIO, proposal, concept)</td><td><input type="text" class="wide" name="approach" value="<?php echo set_value('approach'); ?>"  /></td> </tr>
                    <tr class="darker"><td class="half">Remarks</td><td><input type="text" class="wide" name="remarks" value="<?php echo set_value('remarks'); ?>"/></td> </tr>
                    <tr class="lighter"><td class="half">Contact</td><td><input type="text" class="wide" name="contact" value="<?php echo set_value('contact'); ?>"/></td> </tr>
                   <tr><td colspan="2" style="text-align: right">
                            <input type="submit" value="Submit" />
                            <input type="button" value="Cancel" onclick="hide('#new_opportunities')"/>
                        </td></tr>
                </table>
                </form>
            </div>
            <div id="searchOpportunities" style="display: none;margin-bottom: 10px;">
                <form id="searchOpportunitiesForm">
                    <table>
                        <tr class="darker"><td class="half">Select search criteria</td>
                            <td><select name="field">
                                    <option value='all'> All</option>
                                    <option value='opportunity'>Opportunity</option>
                                    <option value='source'>Source</option>
                                    <option value='beneficiary'>Beneficiary</option>
                                    <option value='approach'>Approach</option>
                                    <option value='remarks'>Remarks</option>
                                    <option value='contact'>Contact</option>
                                    <option value='added_by'>Added by</option>
                                </select></td>
                            <td><input type="text" name="search" class="wide"  value="<?php echo set_value('added_by'); ?>" /></td>
                        </tr>

                        <tr><td colspan="3" style="text-align: right">
                                <input type="button" value="Submit" onclick="searchOpportunities()" />
                                <input type="button" value="Cancel" onclick="hide('#searchOpportunities')"/>
                            </td></tr>

                    </table>
                </form>
            </div>
            <div id="all_docs">
                <?= $pagina ?>
                <?= $tablet ?>
                <?= $pagina ?>
            </div>

        </div>
    </div>
</div>